package top.aicats.pattern.prototype;

import com.sun.xml.internal.messaging.saaj.util.ByteInputStream;

import java.io.*;

public class ProtocolClass implements Cloneable, Serializable {
    private QiTianDaShen qiTianDaShen;

    public ProtocolClass() {
        this.qiTianDaShen = new QiTianDaShen();
    }

    public QiTianDaShen deepClone() throws IOException, ClassNotFoundException {
        ByteArrayOutputStream bs = new ByteArrayOutputStream();
        ObjectOutputStream oos = new ObjectOutputStream(bs);
        oos.writeObject(this);

        ByteArrayInputStream bais = new ByteArrayInputStream(bs.toByteArray());
        ObjectInputStream ois = new ObjectInputStream(bais);

        QiTianDaShen copy = (QiTianDaShen)ois.readObject();
        return copy;
    }


}
